<template>
  <div>
    <img src="@/assets/img/225125-1603896685a35d.jpg" class="bgImg" />
    <div class="content">
      <div class="bidTitle">祥祥的“后台”登录</div>
      <div class="logCon">
        <div class="line">
          <span>账号:</span>
          <input v-model="user.username" class="bt_input" type="text" />
        </div>
        <div class="line">
          <span>密码:</span>
          <input v-model="user.password" class="bt_input" type="text" />
        </div>
        <button type="button" class="logingBut" @click="login">登录</button>
      </div>
    </div>
  </div>
</template>

<script>
// 导入登陆样式
import "@/assets/css/indexa.css";
// 导入请求方法
import { login } from "../../http/http.js";
export default {
  name: "",
  components: {},
  props: [],
  data() {
    return {
      user: {
        username: "",
        password: "",
      },
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    //   登陆
    async login() {
      const { data: res } = await login(this.user);
      console.log(res);
      if (res.msg == "登录成功") {
        this.$message.success(res.msg);
        this.$router.push("/index");
      } else {
        this.$message.error(res.msg);
      }
    },
  },
};
</script>

<style lang='scss' scoped></style>
